package com.leyou.user.client;

import com.leyou.user.dto.UserAddressDTO;
import com.leyou.user.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * user服务的feign接口
 */
@FeignClient("user-service")
public interface UserClient {

    /**
     * 根据用户名和密码查询用户信息
     * @param userName
     * @param passWord
     * @return
     */
    @GetMapping("/query")
    UserDTO queryUser(@RequestParam(name = "username")String userName,
                                             @RequestParam(name = "password")String passWord);

    /**
     * 根据 地址id 获取地址信息
     * @param id 地址id
     * @return 地址信息
     */
    @GetMapping("/address/byId")
    UserAddressDTO queryAddressById(@RequestParam("id") Long id);

    /**
     * 根据userid 和 id查询地址信息
     * @param addressId
     * @param userId
     * @return
     */
    @GetMapping("/address/byUser")
    UserAddressDTO queryAddressByUser(@RequestParam(name="id")Long addressId,
                                                             @RequestParam(name = "userid") Long userId);
}
